import request from '@/utils/request'
import downloadfile from '@/utils/downloadfile'

export function listAdmin(query) {
  return request({
    url: '/sys/user/list',
    method: 'get',
    params: query
  })
}

export function createAdmin(data) {
  return request({
    url: '/sys/user/create',
    method: 'post',
    data
  })
}

export function resetPassword(data) {
  return request({
    url: '/auth/user/resetpassword/' + data.id,
    method: 'get'
  })
}

export function updateAdminPassword(data) {
  return request({
    url: '/auth/user/password',
    method: 'post',
    data
  })
}

export function updateAdmin(data) {
  return request({
    url: '/sys/user/update',
    method: 'post',
    data
  })
}

export function deleteAdmin(data) {
  return request({
    url: '/sys/user/delete/' + data.id,
    method: 'delete'
  })
}

export function exportXsl(data) {
  return downloadfile({
    url: '/sys/user/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}
